#ifndef __APP_DOBBUFFER_H__
#define __APP_DOBBUFFER_H__
#include "app_common.h"
#include "pthread.h"

typedef void* dobbuffer_handle_t;

/// @brief 创建双缓冲区
/// @param capacity 容量
/// @return dobbuffer_handle_t
dobbuffer_handle_t app_dobbuffer_init(int capacity);

/// @brief 清除双缓冲区
/// @param handle
/// @return Com_state_t
Com_state_t app_dobbuffer_deinit(dobbuffer_handle_t handle);
/// @brief 写入双缓冲区
/// @param dobbuffer
/// @param data
/// @param len
/// @return
Com_state_t app_dobbuffer_write(dobbuffer_handle_t handle, const char *data, uint8_t len);

/// @brief 读取缓冲区
/// @param dobbuffer
/// @param data
/// @param len
/// @return
int app_dobbuffer_read(dobbuffer_handle_t handle, char *data, int max_len);


#endif /* __APP_DOBBUFFER_H__ */